<?php

/**
 * UnidadFuncional filter form base class.
 *
 * @package    sf_sandbox
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseUnidadFuncionalFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'codigo'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nro'               => new sfWidgetFormFilterInput(),
      'mbk'               => new sfWidgetFormFilterInput(),
      'piso'              => new sfWidgetFormFilterInput(),
      'dpto'              => new sfWidgetFormFilterInput(),
      'medidor'           => new sfWidgetFormFilterInput(),
      'contribuyente_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Contribuyente'), 'add_empty' => true)),
      'categoria_agua_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('CategoriaAgua'), 'add_empty' => true)),
      'calle_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Calle'), 'add_empty' => true)),
      'barrio_id'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Barrio'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'codigo'            => new sfValidatorPass(array('required' => false)),
      'nro'               => new sfValidatorPass(array('required' => false)),
      'mbk'               => new sfValidatorPass(array('required' => false)),
      'piso'              => new sfValidatorPass(array('required' => false)),
      'dpto'              => new sfValidatorPass(array('required' => false)),
      'medidor'           => new sfValidatorPass(array('required' => false)),
      'contribuyente_id'  => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Contribuyente'), 'column' => 'id')),
      'categoria_agua_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('CategoriaAgua'), 'column' => 'id')),
      'calle_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Calle'), 'column' => 'id')),
      'barrio_id'         => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Barrio'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('unidad_funcional_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'UnidadFuncional';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'codigo'            => 'Text',
      'nro'               => 'Text',
      'mbk'               => 'Text',
      'piso'              => 'Text',
      'dpto'              => 'Text',
      'medidor'           => 'Text',
      'contribuyente_id'  => 'ForeignKey',
      'categoria_agua_id' => 'ForeignKey',
      'calle_id'          => 'ForeignKey',
      'barrio_id'         => 'ForeignKey',
    );
  }
}
